package dal.datastore;

import java.util.ArrayList;

import dto.ColumnDTO;
import dto.RowDTO;

public class TableData {
	private String tableName;
	private ArrayList<ColumnDTO> columns;
	private ArrayList<RowDTO> rows;

	public TableData(String name) {
		this.tableName = name;
		this.rows = new ArrayList<RowDTO>();
		this.columns = new ArrayList<ColumnDTO>();
	}

	public TableData(String name, ArrayList<RowDTO> row) {
		this.tableName = name;
		this.rows = row;
		this.columns = new ArrayList<ColumnDTO>();
	}

	public TableData(String name, ArrayList<RowDTO> row,
			ArrayList<ColumnDTO> column) {
		this.tableName = name;
		this.rows = row;
		this.columns = column;
	}

	public ArrayList<RowDTO> getRows() {
		return this.rows;
	}

	public String getTableName() {
		return this.tableName;
	}

	public void setTableName(String name) {
		this.tableName = name;
	}

	public ArrayList<ColumnDTO> getColumn() {
		return this.columns;
	}

	public void setRows(ArrayList<RowDTO> rows) {
		this.rows = rows;
	}

	public void setColumns(ArrayList<ColumnDTO> column) {
		this.columns = column;
	}

	public void addRow(RowDTO row) {
		this.rows.add(row);
	}

	@Override
	public boolean equals(Object obj) {
		try {
			if (obj != null) {
				return ((TableData) obj).getTableName().equalsIgnoreCase(
						this.tableName);
			}
			return false;
		} catch (Exception e) {
			return false;
		}
	}
}